<?php

/**
 * This is the model class for table "hot_image".
 *
 * The followings are the available columns in table 'hot_image':
 * @property integer $id ID
 * @property string $name Name
 * @property string $link Link
 * @property string $image Image
 * @property integer $sort Sort
 * @property string $cate Cate
 * @property string $open_type Open Type
 * @property integer $status Status
 */
class HotImage extends ActiveRecord
{
	public function scopes(){
		return array(
			'order' => array(
				'order'=>'id DESC',
			),
			'enabled' => array(
				'condition' => 't.`status` = 1',
			),
		);
	}
	
	static public function getHotImages($limit = 4) {
		$criteria=new CDbCriteria;
		$criteria->order = 'sort DESC';
		$criteria->limit = $limit; 
		return self::model()->enabled()->findAll();
	}
	/**
	 * Returns the static model of the specified AR class.
	 * @return HotImage the static model class
	 */
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
	public function getMdcClass() {
		return 'application.models.metadata.HotImageMetadata';
	}
}